// Tags:
#include <algorithm>
#include <cstdio>
#define lowbit(x) (x & -x)

typedef long long ll;
const int N = 1e5 + 5;
int n, m;
ll hash[N], val[N], ans, sum[N];

inline ll query(int pos) {
  ll res = 0;
  while (pos) { res += val[pos], pos -= lowbit(pos); }
  return res;
}

inline void modify(int pos, int v) {
  while (pos <= *hash) { val[pos] += v, pos += lowbit(pos); }
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("snooker.in", "r", stdin);
  freopen("snooker.out", "w", stdout);
#endif
#endif

  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &sum[i]);
    sum[i] += sum[i - 1];
    hash[i] = sum[i] - m * i;
  }
  hash[++n] = 0;
  std::sort(hash + 1, hash + n + 1);
  *hash = std::unique(hash + 1, hash + n + 1) - hash;
  modify(std::lower_bound(hash + 1, hash + *hash + 1, 0) - hash, 1);
  for (int i = 1, k; i <= n; ++i) {
    k = std::lower_bound(hash + 1, hash + *hash + 1, sum[i] - m * i) - hash;
    ans += query(k - 1);
    modify(k, 1);
  }
  printf("%lld", ans);
  return 0;
}